"""
FIVEDASH(TM) -- General Purpose Accounting Software
Copyright (C) 2008  Obol Software Pty Ltd

This program is free software: you can redistribute it and/or modify
it. For terms and conditions, see fivedash/license/license.txt

"""

err_msg_map = {
		'user_not_login':'User not login in',
		'user_not_exist':'User not exist',
		'access_forbit':'You have not enough to access this url',
		'error_password':'error password',
		'db_conn_str_err':'DB Connection String error.Please check it',
		'company_not_exist':'Company not exist',
		'user_no_grant':"User has no right on any company.Please contact System Administator",
		'usergroup_no_right':"The UserGroup has no right.Please contact System Administator",
		#---------hr-----------------------
		'employee_not_exist':'Employee %s not exist',
		'period_not_exist':'Period %s not exist',
		#--------operations-----------------
		'customer_not_exist':'Customer not exist',
		'SYSTEM_ERROR':'Web site error,Please contact system Administator',
		'ADDRESS_NOT_EXISTS':'Address not exist',
		'BILLING_METHOD_ERROR':"There is not a billing addrss or it is a wrong addrss,Please contact system Administator and reset it",
		'SMTP_ERROR':"The SMTP Server Settings error,Please set it before you use it!",
		'LINKED_ACCOUNTS_ERROR':"The linked accounts have not set,Please set them before you create invoice!",
}


class GeneralBusinessErr( Exception ):
        def __init__( self, msg = '',url = '', msgParam = [] ):
                Exception.__init__( self )
                self.msg = msg
                self.url = url
                self.msgParam = msgParam
                
        def getURL(self):
                return self.url
                
        def getErrMsg( self ):
                if len( self.msgParam ) == 0:
                        return err_msg_map[self.msg]
                else:
                        return err_msg_map[self.msg] % tuple( self.msgParam )

                
                
